<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="u" uri="/iuie-tag"%>
<%@ taglib prefix="sys" uri="/sys-tag" %>
<%@ taglib prefix="lui" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>消费记录详情</title>
</head>
<lui:context/>
<u:View basePath="/res-datum/expense" userJS="expenseDetail" userCSS="expenseDetail" delayLoadJs="false">
<body>
    <lui:dialogBody>
    	<sys:dropCodeSet codeTypes="consumeType,consumeChannel,consumeAddress,isCountTime,isInstalment,recommendLevel" id="codeSet"/>
        <form class="m-cust m-narrow" id='expenseDetailFrm'>
	        <fieldset class="m-narrow">
				<legend>基本信息</legend>
	        	<table class='m-composing m-full-width'>
	        		<tr>
				        <td>商品金额：</td>
				        <td><input name="productAmount" class="m-input" readonly="readonly"></td>
				        <td>商品名称：</td>
				        <td><input name="productName" class="m-input" readonly="readonly"></td>
				        <td>消费时间：</td>
				        <td><input name="consumeTime" class="m-input" readonly="readonly"></td>
				    </tr>
				    <tr>
				        <td>消费类型：</td>
				        <td><input name="consumeType" class="m-input" readonly="readonly" data-code='codeSet.consumeType'></td>
				        <td>消费渠道：</td>
				        <td><input name="consumeChannel" class="m-input" readonly="readonly" data-code='codeSet.consumeChannel'></td>
				        <td>消费地点：</td>
				        <td><input name="consumeAddress" class="m-input" readonly="readonly" data-code="codeSet.consumeAddress"></td>
				    </tr>
				    <tr>
				        <td>消费金额：</td>
				        <td><input name="consumeAmount" class="m-input" readonly="readonly"></td>
				        <td>计时信息：</td>
				        <td><input name=isCountTime class="m-input" readonly="readonly" data-code='codeSet.isCountTime'></td>
				        <td>分期信息：</td>
				        <td><input name="isInstalment" class="m-input" readonly="readonly" data-code="codeSet.isInstalment"></td>
				    </tr>
				    <tr>
				        <td>推荐系数：</td>
				        <td><input name="recommend" class="m-input" readonly="readonly" data-code='codeSet.recommendLevel'></td>
				        <td colspan="4">
				    </tr>
				    <tr>
				    	<td>备注：</td>
				    	<td colspan="5">
				    		<textarea name="remark" class="form-control m-input" readonly="readonly" width="100%" rows="2"></textarea>
				    	</td>
				    </tr>
	        	</table>
			</fieldset>
        </form>
        <form class="m-cust m-narrow" id='instalmentDetailFrm' data-hide='true'>
        	<fieldset class="m-narrow">
				<legend>分期详情</legend>
				<u:dataSet id="instalmentDetailSet" idField="id">
					<u:dataField name="id" display="ID" visiable="false"/>
					<u:dataField name="expenseId" display="消费ID" visiable="false"/>
					<u:dataField name="repayDate" display="还款时间" width="120px"/>
					<u:dataField name="repayNum" display="还款期数" width="60px"/>
					<u:dataField name="repayAmount" display="还款金额" width="120px"/>
					<u:dataField name="createTime" display="创建时间" visiable="false"/>
					<u:dataField name="updateTime" display="更新时间" visiable="false"/>
					<u:dataField name="realRepayDate" display="实际还款时间" width="140px"/>
					<u:dataField name="userId" display="用户ID" visiable="false"/>
					<u:dataField name="userName" display="用户姓名" visiable="false"/>
					<u:dataField name="isRepay" display="是否已还" width="60px"/>
					<u:dataField name="remark" display="备注"/>
				</u:dataSet>
				<!-- 获取用户信息列表ajax -->
				<lui:ajax id="findInstalmentDetailAjax" url="${ctx }/expense/find/page/instalmentDetails/${requestScope.id }" formQuery="#instalmentDetailFrm" 
					onSuccess="ExpenseDetailPage.onQuerySucc"/>
				<lui:datatable id="datatable" ajax="findInstalmentDetailAjax" sortable="true" dataset="instalmentDetailSet" checkable="false"
				    multiple="false" cutLine="true" onRenderItem="ExpenseDetailPage.onRenderItem" pagination="pagination"/>
				<lui:pagination datatable="datatable" id="pagination" pageSize="15" showPageChoice="false"/>
			</fieldset>
        </form>
        <lui:ajax id="findByIdAjax" url="${ctx }/expense/find/id/${requestScope.id}" onSuccess="ExpenseDetailPage.onFindOneSucc" type="get" 
       		contentType="application/x-www-form-urlencoded" autoSend="true"/>
       	<lui:ajax id="updateRepayAmountAjax" url="${ctx }/expense/update/repayAmount/" onSuccess="ExpenseDetailPage.updateRepayAmountSucc"
       		type="post" contentType="application/x-www-form-urlencoded"/>
       	<lui:ajax id="updateRemarkAjax" url="${ctx }/expense/update/remark/" onSuccess="ExpenseDetailPage.updateRemarkSucc"
       		type="post" contentType="application/x-www-form-urlencoded"/>
       	<lui:ajax id="updateRepayStateAjax" url="${ctx }/expense/update/isRepay/" onSuccess="ExpenseDetailPage.updateRepayStateSucc"
       		type="post" contentType="application/x-www-form-urlencoded"/>
        <form id="expenseFileFrm" class='m-cust'>
        	<fieldset class="m-narrow">
				<legend>附件</legend>
				<input hidden="hidden" name="fileType" value="expenseAttachment">
				<input hidden="hidden" name="targetId" value="${requestScope.id }">
				<u:dropListView id="dropView_oper">
				    <u:dropView name="download" template="download" onClick="ExpenseDetailPage.download" title="下载"/>
				</u:dropListView>
				<u:dataSet id="fileInfoSet">
					<u:dataField name="fileId" display="文件ID" visiable="false"/>
					<u:dataField name="fileName" display="文件服务器名称" visiable="false"/>
					<u:dataField name="originalName" display="原始文件名"/>
					<u:dataField name="fileSize" display="文件大小"/>
					<u:dataField name="uploadTime" display="上传时间"/>
					<u:dataField name="downloadCount" display="下载次数"/>
					<u:dataField name="oper" display="操作" dropView="dropView_oper"/>
				</u:dataSet>
				<!-- 更新下载次数 -->
	       		<lui:ajax url="${ctx }/datum/file/updateDownloadCount" id="updateDownloadCountAjax" onSuccess="ExpenseDetailPage.onUpdateDownloadCountSucc"/>
				<!-- 获取附件列表ajax -->
				<lui:ajax id="findExpenseFileAjax" url="${ctx }/datum/file/findByPage" formQuery="#expenseFileFrm"/>
				<lui:datatable id="expenseFileDatatable" ajax="findExpenseFileAjax" sortable="true" pagination="expenseFilePagination" 
					dataset="fileInfoSet" checkable="true" multiple="false" cutLine="true"/>
				<lui:pagination datatable="expenseFileDatatable" id="expenseFilePagination" pageSize="5" pageChoice="5" showPageChoice="false"/>
			</fieldset>
		</form>
    </lui:dialogBody>
    <lui:dialogFooter>
       <button class="btn btn-default m-btn" type="button" data-dismiss="dialog-box">关闭</button>
    </lui:dialogFooter>
</body>
</u:View>
</html>